import * as core from "../core"
import GameEntities from "../scene/Game/GameEntities";

const { ccclass, property } = cc._decorator;

@ccclass
export default class Stone extends cc.Component {
    public static gameEntities: GameEntities = null
    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}

    start() {

    }

    update(dt: number) { }

    explosionMe() {
        let self = this
        let pos = self.node.getPosition().clone()
        self.node.removeFromParent(true)

        core.NodePool.getInstance().loadNode("prefab/StoneExplosion", (n: cc.Node) => {
            Stone.gameEntities.node.addChild(n)
            n.setPosition(pos)
            n.getComponent(cc.ParticleSystem).resetSystem()
        }, 0)
    }
}
